Data Structures Interview Questions and Answers
Ques 26. What is precision?
Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point.
Ques 27. What is impact of signed numbers on the memory?
Sign of the number is the first bit of the storage allocated for that number. So you get one bit less for storing the number. For example if you are storing an 8-bit number, without sign, the range is 0-255. If you decide to store sign you get 7 bits for the number plus one bit for the sign. So the range is -128 to +127.
Ques 28. How memory is reserved using a declaration statement ?
Memory is reserved using data type in the variable declaration. A programming language implementation has predefined sizes for its data types.
For example, in C# the declaration int i; will reserve 32 bits for variable i.
A pointer declaration reserves memory for the address or the pointer variable, but not for the data that it will point to. The memory for the data pointed by a pointer has to be allocated at runtime.
The memory reserved by the compiler for simple variables and for storing pointer address is allocated on the stack, while the memory allocated for pointer referenced data at runtime is allocated on the heap.
Ques 29. How many parts are there in a declaration statement?
There are two main parts, variable identifier and data type and the third type is optional which is type qualifier like signed/unsigned.
Ques 30. Is Pointer a variable?
Yes, a pointer is a variable and can be used as an element of a structure and as an attribute of a class in some programming languages such as C++, but not Java. However, the contents of a pointer is a memory address of another location of memory, which is usually the memory address of another variable, element of a structure, or attribute of a class.
Most helpful rated by users:
- What is data structure?
- List out the areas in which data structures are applied extensively?
- What is the data structures used to perform recursion?
- If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
- What are the methods available in storing sequential files ?